Skip to content

fix: restore double-click to copy account ID and hide account ID from row#244

Merged
YCC3741 merged 9 commits intocodefrom
fix/issue-239-dblclick-copy
Apr 26, 2026
Merged

fix: restore double-click to copy account ID and hide account ID from row#244
YCC3741 merged 9 commits intocodefrom
fix/issue-239-dblclick-copy

Conversation

@YCC3741
Copy link
Copy Markdown
Collaborator

@YCC3741 YCC3741 commented Apr 25, 2026

Summary

  • Restore double-click to copy account ID: Add @dblclick handler on account rows that copies the row's service-account ID (a.sid) to the clipboard via navigator.clipboard.writeText, mirroring the WPF lstViewAccount_MouseDoubleClick behaviour (Clipboard.SetText(selected.sid)) reported missing in #239 (問題一). The existing i18n key DoubleClickCopy ("雙擊複製帳號" / "Double-click to copy account") already documents this WPF semantic.
  • Hide account ID from row: Remove the ID: xxx subtitle from account rows, showing only the account display name. Banned status text is preserved.

Changes

  • src/pages/AccountList.vue:
    • New handleRowDblClick(a) async handler:
      • Banned-row guard (if (!a.is_enable) return) preserved
      • await navigator.clipboard.writeText(a.sid) then ElMessage.success(t('CopyFinished'))
      • On clipboard rejection (permission / trust-boundary) → ElMessage.error(t('CopyFailed'))
      • Does not mutate account.selectedSid and does not call handleGetOtp() — those belong to the single-click + Enter / Get OTP button path
    • Bind @dblclick on each account row
    • Remove ID display from row subtitle; keep banned-status text only
  • tests/unit/pages/AccountList.spec.ts:
    • 'double-clicking an enabled row...' now asserts clipboard.writeText('sid-2') + CopyFinished toast, and that commands.getOtp was not called and account.selectedSid was not mutated
    • 'double-clicking a banned row...' asserts clipboard.writeText was not called

Test plan

  • Double-click an enabled account row → row's account ID is copied to clipboard, "複製完成" toast appears
  • Double-click a banned account row → nothing happens (no clipboard write, no toast)
  • Account rows display only the name, no ID subtitle
  • Banned rows still show the locked status text
  • Single-click still selects the row normally
  • Enter hotkey still triggers Get OTP after row selection
  • Selection state (e.g. from PR 新版本不会默认选择第一个。 #245 auto-select) is preserved across double-click

Local verification

Closes #239

@lshw54
Copy link
Copy Markdown
Collaborator

lshw54 commented Apr 26, 2026

The double-click handler is wiring up the wrong action. According to issue #239, the original WPF lstViewAccount_MouseDoubleClick behaviour was to copy the service account ID (a.sid) to the clipboard — not to fetch and copy the OTP.
handleRowDblClick should be simplified to just copy a.sid directly.

The handleGetOtp() call should be removed entirely from this handler. Please also update the PR title, summary, and test plan accordingly — the test currently asserts that commands.getOtp is called on double-click, which would no longer be the expected behaviour.

Comment thread src/pages/AccountList.vue Outdated
Comment thread tests/unit/pages/AccountList.spec.ts Outdated
@lshw54
Copy link
Copy Markdown
Collaborator

lshw54 commented Apr 26, 2026

Please also note that #248, #250, #251, #252 and #253 is already merge, make sure to review and incorporate those changes before merging this PR to avoid any conflicts.

YCC3741 added 9 commits April 26, 2026 16:43
…dback)

Per @lshw54's review on #244: WPF `lstViewAccount_MouseDoubleClick`
only called `Clipboard.SetText(selected.sid)` -- it never armed the
selection or fetched an OTP. Replace the `handleGetOtp()` chain with
a direct `navigator.clipboard.writeText(a.sid)` + `CopyFinished` /
`CopyFailed` toast pair, and update the dblclick spec to assert the
clipboard write (and the absence of an OTP IPC) instead.

Banned-row guard is preserved; the i18n key `DoubleClickCopy`
("雙擊複製帳號" / "Double-click to copy account") already documents
this WPF parity.

Refs #239
@YCC3741 YCC3741 force-pushed the fix/issue-239-dblclick-copy branch from fc60b03 to 207d077 Compare April 26, 2026 08:48
@YCC3741 YCC3741 changed the title fix: restore double-click to copy OTP and hide account ID from row fix: restore double-click to copy account ID and hide account ID from row Apr 26, 2026
Copy link
Copy Markdown
Collaborator

@lshw54 lshw54 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good now!

@YCC3741 YCC3741 merged commit 8a5eb29 into code Apr 26, 2026
3 checks passed
@YCC3741 YCC3741 deleted the fix/issue-239-dblclick-copy branch April 26, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v5.9.4 Issues] UI layout broken on non-100% DPI & Performance issues in HK region

2 participants